package com.zipking.cloud.springbootmybatis.service;

import com.zipking.cloud.springbootmybatis.handle.AbstractPayCallbackHandler;
import com.zipking.cloud.springbootmybatis.model.AliPayCallbackRequest;
import com.zipking.cloud.springbootmybatis.model.PayCallbackRequest;
import com.zipking.cloud.springbootmybatis.enums.PayChannelEnum;
import com.zipking.cloud.springbootmybatis.strategy.AbstractExecuteStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public final class AliPayCallbackHandler  extends AbstractPayCallbackHandler implements AbstractExecuteStrategy<PayCallbackRequest, Void> {


    @Override
    public void callback(PayCallbackRequest payCallbackRequest) {
        AliPayCallbackRequest aliPayCallBackRequest = payCallbackRequest.getAliPayCallBackRequest();
        /*PayCallbackReqDTO payCallbackRequestParam = PayCallbackReqDTO.builder()
                .status(TradeStatusEnum.queryActualTradeStatusCode(aliPayCallBackRequest.getTradeStatus()))
                .payAmount(aliPayCallBackRequest.getBuyerPayAmount())
                .tradeNo(aliPayCallBackRequest.getTradeNo())
                .gmtPayment(aliPayCallBackRequest.getGmtPayment())
                .orderSn(aliPayCallBackRequest.getOrderRequestId())
                .build();*/
      //  payService.callbackPay(payCallbackRequestParam);
    }

    @Override
    public String mark() {
        return PayChannelEnum.ALI_PAY.name();
    }

    public void execute(PayCallbackRequest requestParam) {
        callback(requestParam);
    }
}
